home *** CD-ROM | disk | FTP | other *** search
- /*
- * the class EDIT_DIVIDE
- * Copyright (C) 1996, 1997 Kazutaka Hirata <khirata@jove.acs.unt.edu>
- */
-
- #include "../stdafx.h"
-
- #include "../common/bool.h"
-
- #include "eddivide.h"
-
- STAGE* EDIT_DIVIDE::init_new(KBAN_INFO& info, KBAN_DRAW& draw)
- {
- return new STAGE_SELECT;
- }
-
- const char* EDIT_DIVIDE::get_name(void)
- {
- return "Edit:Divide";
- }
-
- STAGE* EDIT_DIVIDE::STAGE_SELECT::mouse_left_down(KBAN_INFO& info, KBAN_DRAW& draw, const XY& pc, UINT nFlags)
- {
- PRIMITIVE& primitive = info.kban_data().primitive();
- LINE_LIST& line_list = primitive.layer(info.active_layer().get()).line_list();
- XY ac;
- GRID& grid = info.grid();
- grid.xy_pc2ac_with_snap_off(pc, ac);
-
- XYT eps = grid.distance_pc2ac(20);
- LINE_ELEMENT* target = line_list.search(eps, ac);
- STAGE* ret;
- if(target != NULL) {
- ret = new STAGE_DIVIDE(target, info.active_layer().get());
- } else {
- ret = this;
- }
-
- return ret;
- }
-
- STAGE* EDIT_DIVIDE::STAGE_SELECT::mouse_right_up(KBAN_INFO& info, KBAN_DRAW& draw, const XY& pc, UINT nFlags)
- {
- return NULL;
- }
-
- EDIT_DIVIDE::STAGE_DIVIDE::STAGE_DIVIDE(LINE_ELEMENT* target, uint layer)
- : STAGE_DIVIDE_CORE(target, layer)
- {
- }
-
- STAGE* EDIT_DIVIDE::STAGE_DIVIDE::mouse_left_up(KBAN_INFO& info, KBAN_DRAW& draw, const XY& pc, UINT nFlags)
- {
- STAGE_DIVIDE_CORE::mouse_left_up(info, draw, pc, nFlags);
- return new STAGE_SELECT;
- }
-
- STAGE* EDIT_DIVIDE::STAGE_DIVIDE::mouse_right_up(KBAN_INFO& info, KBAN_DRAW& draw, const XY& pc, UINT nFlags)
- {
- STAGE_DIVIDE_CORE::mouse_right_up(info, draw, pc, nFlags);
- return new STAGE_SELECT;
- }
-